Skip to content

Support ALL CATALOGS in GetTables for SQL Execution API#815

Merged
jayantsing-db merged 6 commits into
mainfrom
jayantsing-db/show-tables-all-catalogs
May 12, 2025
Merged

Support ALL CATALOGS in GetTables for SQL Execution API#815
jayantsing-db merged 6 commits into
mainfrom
jayantsing-db/show-tables-all-catalogs

Conversation

@jayantsing-db

@jayantsing-db jayantsing-db commented May 1, 2025

Copy link
Copy Markdown
Collaborator

Description

DBR now supports retrieving tables and views from all catalogs using the SQL command SHOW TABLES FROM/IN ALL CATALOGS .... This pull request updates the SQL Exec API metadata client to leverage this command when the catalog parameter is set to null in the DatabaseMetaData#getTables method.

Testing

  • Unit tests
  • Manual E2E tests

Additional Notes to the Reviewer

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the SQL Execution API to support fetching tables and views from all catalogs by leveraging the new SHOW TABLES FROM/IN ALL CATALOGS command. Key changes include updating error handling for null or wildcard catalog values in the CommandBuilder, removing an unnecessary exception in the metadata client's listTables tests, and updating related tests and constants.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/test/java/com/databricks/jdbc/dbclient/impl/sqlexec/DatabricksMetadataSdkClientTest.java Removed exception assertion for listTables when catalog is null to support multi-catalog behavior.
src/test/java/com/databricks/jdbc/dbclient/impl/sqlexec/CommandBuilderTest.java Added tests covering new scenarios for listTables SQL generation, including all catalogs and wildcard catalog cases.
src/main/java/com/databricks/jdbc/dbclient/impl/sqlexec/CommandBuilder.java Updated SQL generation logic to handle null or wildcard catalog values by using SHOW TABLES IN ALL CATALOGS.
src/main/java/com/databricks/jdbc/dbclient/impl/common/CommandConstants.java Added new constant for SHOW_TABLES_IN_ALL_CATALOGS_SQL and removed an unused constant.
NEXT_CHANGELOG.md Updated changelog to document the new multi-catalog support.
Comments suppressed due to low confidence (1)

src/test/java/com/databricks/jdbc/dbclient/impl/sqlexec/DatabricksMetadataSdkClientTest.java:750

  • Since null catalogs are now supported for listTables, consider adding a test to verify the correct behavior (e.g., verifying the returned SQL or result) instead of asserting an exception.
assertThrows( DatabricksValidationException.class, () -> metadataClient.listTables(session, null, TEST_SCHEMA, TEST_TABLE, null));

Comment thread src/main/java/com/databricks/jdbc/dbclient/impl/sqlexec/CommandBuilder.java Outdated
Comment thread src/main/java/com/databricks/jdbc/dbclient/impl/sqlexec/CommandBuilder.java Outdated
@jayantsing-db jayantsing-db merged commit 016dc1f into databricks:main May 12, 2025
16 checks passed
@jayantsing-db jayantsing-db deleted the jayantsing-db/show-tables-all-catalogs branch May 12, 2025 06:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants